<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>添加员工页面</h1>
<form action="">
    <input type="text" name="name" placeholder="姓名">
    <input type="text" name="sal" placeholder="工资">
    <input type="text" name="job" placeholder="工作">
    <input type="button" value="添加" @click="add()">
</form>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    let vm =new Vue({
        el:"form",
        data:{},
        methods:{
            add:function () {
                let data =new FormData(document.querySelector("form"));
                axios.post("/add",data).then(function () {
                    alert("添加完成！");
                    location.href="/";//显示首页
                })
            }
        }
    })
</script>
</body>
</html>